# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/18 下午5:31
 @Author  : tgy

 切片可以赋值,取值，删除指定范围的值
"""


def test01():
    ...
    name = 'zhangsan'
    s = slice(1, 3)
    print(name[s])


def test02():
    ...
    nums = [x for x in range(20)]
    s = slice(0, len(nums), 2)
    # nums[s] = [7,2]
    # print(nums)
    print(s.stop)
    del nums[s]
    print(nums)


def test03():
    ...
    a = slice(10, 50, 2)
    name = 'zhangsan'
    new_a = a.indices(len(name))
    print(new_a)
    for x in range(*new_a):
        print(name[x])


def test04():
    ...
    nums = [x for x in range(10)]
    s = slice(23, 25)
    nums[s] = {34, 35, 67, 69}
    print(nums)


if __name__ == '__main__':
    ...
    test04()
